<template>
	<view>
		<UserCollect :authorData="userInfo" type="self"/>
	</view>
</template>

<script setup>
	import { onShow } from '@dcloudio/uni-app'
	import {ref} from 'vue'
	import {userStore} from '@/stores/user'
	import {UserModel} from '@/service/model/user'
	import UserCollect from '@/components/UserCollect/UserCollect.vue'
	const userstore=userStore()
	const userInfo=ref({})
	const userModel = new UserModel()
	
	//获取用户信息
	const getUserInfoFun=async()=>{
		const {data,success}=await userModel.getUserInfo()
		if(success){
			userstore.setUserInfo(data)
			userInfo.value=data
		}
	}
	const init=()=>{
		if(uni.getStorageSync('token')){
			getUserInfoFun()
		}else{
			userInfo.value={}
		}
	}
	onShow(()=>{
		init()
	})
</script>

<style lang="less">

</style>
